<?php
function baseUrl(){	return BASE_URL; }
function _baseUrl(){ echo baseUrl(); }

//get url with end module
function moduleUrl( $v , $setLang = false){
	if( $setLang ){
		return implode('/',array(BASE_URL,$v->language,$v->module));
	}else{
		return implode('/',array(BASE_URL,$v->module));
	}	
}

function _moduleUrl( $v , $setLang = false){
	_e( moduleUrl($v, $setLang) );
}

//get url with end controller
function ctrUrl( $v , $setLang = false){
	if( $setLang ){
		return implode('/',array(BASE_URL,$v->language,$v->module,$v->controller));
	}else{
		return implode('/',array(BASE_URL,$v->module,$v->controller));
	}	
}

function _ctrUrl( $v , $setLang = false){
	_e( ctrUrl($v, $setLang) );
}

//get url with end action
function actionUrl( $v , $setLang = false){
	if( $setLang ){
		return implode('/',array(BASE_URL,$v->language,$v->module,$v->controller,$v->action));
	}else{
		return implode('/',array(BASE_URL,$v->module,$v->controller,$v->action));
	}	
}

function _actionUrl( $v , $setLang = false){
	_e( actionUrl($v, $setLang) );
}


function current_url(){
	return (isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS'] ? 'https://':'http://')
		.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'];
}

function current_domain(){
	return (isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS'] ? 'https://':'http://')
		.$_SERVER['SERVER_NAME'];
}
